use std::sync::Arc;

use lazy_static::lazy_static;
use ruma::RoomVersionId;
use tokio::sync::Mutex;

use crate::server::{Config, CONFIG};

pub struct Service {
    services: Services,
    // pub mutex: Arc<HashMap<OwnedRoomId, tokio::sync::Mutex<()>>>,
    pub mutex: Arc<Mutex<()>>,
}

lazy_static! {
    pub static ref SERVICE: Arc<Service> = Arc::new(Service::build());
}
struct Services {
    config: Config,
}

impl Service {
    pub fn build() -> Self {
        Self {
            services: Services {
                config: CONFIG.clone(),
            },
            // mutex: Arc::new(HashMap::new()),
            mutex: Arc::new(Mutex::new(())),
        }
    }

    pub fn get_room_version(&self) -> RoomVersionId {
        self.services.config.default_room_version.clone()
    }
}
